#include <stdio.h>
#include <stdint.h>


// ==================
// purpose: 句柄管理，默认配置为支持线程安全
//

#define unsigned char uchar
#define unsigned int  ulong
#define unsigned int  handle

#define HANDLE_SHIFT_INDEX      0
#define HANDLE_MASK_INDEX       0x000fffff
#define HANDLE_SHIFT_COUNT      20
#define HANDLE_MASK_COUNT       0xfff00000

#define handleLock
#define GROW_COUNT  512
#define INVALID_HANDLE          (handle) 0

#define handleFromIndex(h)      ((ulong)(h))
#define handleFromCount(h)      (((ulong)(h)) << HANDLE_MASK_COUNT)
